
from rest_framework import serializers


from . import models

class CategoryModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = models.CourseCategory
        fields = [
            'id',
            'name'
        ]


class TeacherModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = models.Teacher
        fields = [
            'name',
            'title',
            'signature',
            'image',
            'brief',
        ]


class CourseFreeModelSerializer(serializers.ModelSerializer):

    teacher = TeacherModelSerializer()

    class Meta:
        model = models.Course
        fields = [
            'id',
            'course_img',
            'name',
            'students',
            'teacher',
            'sections',
            'pub_sections',
            'section_list',
            'price'
        ]
